/*
 * @Author: wuqingchun
 * @Date: 2024-05-30 15:16:24
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-05-30 15:49:10
 */
#ifndef __SPINLOCK_H__
#define __SPINLOCK_H__

#include <atomic>

class SpinLock
{
public:
    void lock()
    {
        while (m_bFlag.exchange(true))
        {
            
        }
    }

    void unlock()
    {
        m_bFlag.store(false);
    }

private:
    std::atomic<bool> m_bFlag;
};

#endif //__SPINLOCK_H__